//
// Created by Admin on 2021/9/20.
//

#include <time.h>
#include "entry.h"

void inputInfo(pStudent students, int student_count, int subject_count){
    for (int i = 0; i < student_count; i++) {
        printf("当前正在录入学生%d的信息\n",i);
        printf("学号：");scanf("%d",&students[i].number);
        printf("姓名：");scanf("%s",students[i].name);
        for (int j = 0; j < subject_count; j++) {
            printf("学科%d成绩：",j);scanf("%d",&students[i].subjects[j].score);
        }
    }
}

void inputRandInfo(pStudent students, int student_count, int subject_count){
    srand(time(NULL));
    for (int i = 0; i < student_count; i++) {
        students[i].number = 10000000 + (rand()%90000000);
        int name_len =  10 + rand()%10;
        for(int t=0;t<name_len;t++){
            students[i].name[t] = (char)('a' + rand()%('z'-'a'));
        }
        for (int j = 0; j < subject_count; j++) {
            students[i].subjects[j].score = 51 + rand()%50;
        }
    }
    outputInfo(students,student_count,subject_count);
}